﻿using System;
namespace Producers.Doc.Xtee.Riik.Ee.Producer.Doc {
    
    
    public class DressSizeType : global::Xtee.Schema.XsdInteger {
        
        public const decimal N5 = 5;
        
        public DressSizeType(decimal value) : 
                base(value) {
            this.SuuremVordneKui = (System.Decimal)2;
            this.VaiksemVordneKui = (System.Decimal)18;
            this.Pattern = @"\d{1,2}";
            this.Validate();
            string annot = null;
            if (Value == 5) {
                annot = "5";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public DressSizeType(string value) : 
                base(value) {
            this.SuuremVordneKui = (System.Decimal)2;
            this.VaiksemVordneKui = (System.Decimal)18;
            this.Pattern = @"\d{1,2}";
            this.Validate();
            string annot = null;
            if (Value == 5) {
                annot = "5";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public DressSizeType() : 
                base(new decimal()) {
        }
        
        public static bool TryParse(string value, out global::Producers.Doc.Xtee.Riik.Ee.Producer.Doc.DressSizeType result) {
            try {
                result = new global::Producers.Doc.Xtee.Riik.Ee.Producer.Doc.DressSizeType(value);
                return true;
            }
            catch (System.Exception ex) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator Decimal (DressSizeType value) {
            return value.Value;
        }
        
        public static implicit operator DressSizeType (decimal value) {
            return new DressSizeType(value);
        }
    }
}
